#include <iostream>
#include <string>

bool is_balanced(const std::string& s) {
    int counter = 0;
    for (char c : s) {
        if (c == '(' || c == '[' || c == '{' || c == '<') {
            counter++;
        } else if (c == ')' || c == ']' || c == '}' || c == '>') {
            counter--;
            if (counter < 0) {
                return false;
            }
        }
    }
    return counter == 0;
}

int main() {
    std::cout << "Input parenthesis sequence: \n";
    std::string s;
    std::getline(std::cin, s);

    if (is_balanced(s)) {
        std::cout << "Correct\n";
    } else {
        std::cout << "Incorrect\n";
    }

    return 0;
}
